package com.appsindy.common.util;

//import com.kcs.dl.bo.user.User;
import java.text.SimpleDateFormat;
import java.util.Date;

public class BeanUtility {
    
    public final static String version = "$Rev: 0 $";
    
    /*public static void BO2VORepoDeal(RepoDealVO vo, RepoDeal bo){
        try{
            if(bo != null && vo != null){            
                vo.setId(""+bo.getId());
                vo.setDealNo(""+bo.getDealNo());
                vo.setTranNo(bo.getTranNo());
                vo.setTradeDate(DateUtils.getDateStr(bo.getTradeDate(), false));
                vo.setDraft(""+bo.getDraft());
                vo.setYearBasis(""+bo.getYearBasis());
                vo.setAuthorizedLevel(""+bo.getAuthorizedLevel());
                vo.setSettlementDate(DateUtils.getDateStr(bo.getSettlementDate(), false));
                vo.setPeriod(bo.getPeriod());
                vo.setMaturityDate(DateUtils.getDateStr(bo.getMaturityDate(), false));
                vo.setPurchasePrice(NumberUtil.getNumberStr(bo.getPurchasePrice(), 2));
                vo.setRepoIntRate(NumberUtil.getNumberStr(bo.getRepoIntRate(), 6));
                vo.setInterestAmount(NumberUtil.getNumberStr(bo.getInterestAmount(), 2));
                vo.setRepurchasePrice(NumberUtil.getNumberStr(bo.getRepurchasePrice(), 2));
                vo.setCounterPartyLimitFlag(bo.getCounterPartyLimitFlag());

                if(bo.getReportTime() != null){
                    SimpleDateFormat format = new SimpleDateFormat("HH:mm");
                    Date d = bo.getReportTime();
                    vo.setReportTime(format.format(d));
                }
                vo.setSystemDate(DateUtils.getDateStr(bo.getSystemDate(), false));
                vo.setWithHoldingTaxAmt(NumberUtil.getNumberStr(bo.getWithHoldingTaxAmt(), 2));
                vo.setCommentaries(bo.getCommentaries());
                vo.setBilateralContractNo(bo.getBilateralContractNo());
                vo.setDealStatus(bo.getDealStatus());
                vo.setTerminationValue(NumberUtil.getNumberStr(bo.getTerminationValue(), 2));
                vo.setTerminationDate(DateUtils.getDateStr(bo.getTerminateDate(), false));
                vo.setRemarkCancel(bo.getRemarkCancel());
                vo.setCancelStatus(bo.getCancelStatus());
                vo.setCancelDate(DateUtils.getDateStr(bo.getCancelDate(), false));
                vo.setBalanceFlag(""+bo.getBalanceFlag());

                vo.setWithHoldingTax(NumberUtil.getNumberStr(bo.getWithHoldingTax(), 2));
                                
                BO2VODealer(vo.getDealerVO(), bo.getDealer());
                BO2VOUser(vo.getTraderVO(), bo.getTrader());
                BO2VOInstrument(vo.getInstrumentVO(), bo.getInstrument());
                BO2VOInstType(vo.getInstTypeVO(), bo.getInstType());
                BO2VOTransType(vo.getTransTypeVO(), bo.getTransType());
                BO2VOPortfolio(vo.getPortfolioVO(), bo.getPortfolio());
                BO2VOPurpose(vo.getPurposeVO(), bo.getPurpose());
                BO2VOMarginPaymentMethod(vo.getMarginPaymentMethodVO(), bo.getMarginPaymentMethod());
                BO2VORepoIntTerm(vo.getRepoIntTermVO(), bo.getRepoIntTerm());
                BO2VOPaymentMethod(vo.getPaymentMethodVO(), bo.getPaymentMethod());
                BO2VODeskBook(vo.getDeskBookVO(), bo.getDeskBook());
                BO2VOCurrency(vo.getCurrencyVO(), bo.getCurrency());
                BO2VOCounterParty(vo.getCounterPartyVO(), bo.getCounterParty());
                BO2VOProcessSwift(vo.getProcessSwiftVO(), bo.getProcessSwift());           
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void BO2VODealer(DealerVO vo, Dealer bo){
        try{
            if(bo != null && vo != null){            
                vo.setId(""+bo.getId());
                vo.setDealerCode(bo.getDealerCode());
                vo.setDealerName(bo.getDealerName());
                vo.setCreateDate(DateUtils.getDateStr(bo.getCreateDate(), false));
                vo.setCreateBy(bo.getCreateBy());
                vo.setUpdateDate(DateUtils.getDateStr(bo.getUpdateDate(), false));
                vo.setUpdateBy(bo.getUpdateBy());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void BO2VOUser(UserVO vo, User bo){
        try{
            if(bo != null && vo != null){            
                vo.setUserId(bo.getUserId());
                vo.setPassword(bo.getPassword());
                vo.setStatus(bo.getStatus());
                vo.setName(bo.getName());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void BO2VOInstrument(InstrumentVO vo, Instrument bo){
        try{
            if(bo != null && vo != null){            
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());
                vo.setMonth(""+bo.getMonth());
                vo.setIncrementorUnit(NumberUtil.getNumberStr(bo.getIncrementorUnit(), 2));
                vo.setMinimum(NumberUtil.getNumberStr(bo.getMinimum(), 2));
                vo.setMaximum(NumberUtil.getNumberStr(bo.getMaximum(), 2));
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOInstType(InstTypeVO vo, InstType bo){
        try{
            if(bo != null && vo != null){  
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOTransType(TransTypeVO vo, TransType bo){
        try{
            if(bo != null && vo != null){     
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOPortfolio(PortfolioVO vo, Portfolio bo){
        try{
            if(bo != null && vo != null){            
                vo.setId(bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOPurpose(PurposeVO vo, Purpose bo){
        try{
            if(bo != null && vo != null){  
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
                vo.setShort_desc(bo.getShort_desc());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOMarginPaymentMethod(MarginPaymentMethodVO vo, MarginPaymentMethod bo){
        try{
            if(bo != null && vo != null){          
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VORepoIntTerm(RepoIntTermVO vo, RepoIntTerm bo){
        try{
            if(bo != null && vo != null){           
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOPaymentMethod(PaymentMethodVO vo, PaymentMethod bo){
        try{
            if(bo != null && vo != null){   
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VODeskBook(DeskBookVO vo, DeskBook bo){
        try{
            if(bo != null && vo != null){   
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOCurrency(CurrencyVO vo, Currency bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setCurrencyCode(bo.getCurrencyCode());
                vo.setDescription(bo.getDescription());     
                vo.setGlCurCode(bo.getGlCurCode());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOCounterParty(CounterPartyVO vo, CounterParty bo){
        try{
            if(bo != null && vo != null){   
                vo.setId(""+bo.getId());
                vo.setCustCode(bo.getCustCode());
                vo.setEngName(bo.getEngName());
                vo.setAddress1(bo.getAddress1());
                vo.setThaiName(bo.getThaiName());
                vo.setSwiftCode(bo.getSwiftCode());
                vo.setCaNo(bo.getCaNo());
                vo.setSaNo(bo.getSaNo());
                vo.setContactName(bo.getContactName());
                vo.setTelNo(bo.getTelNo());
                vo.setFaxNo(bo.getFaxNo());
                vo.setSignedISMADate(bo.getSignedISMADate());
                vo.setAccountNo(bo.getAccountNo());
                vo.setThreshold(NumberUtil.getNumberStr(bo.getThreshold(), 2));
                vo.setWithholdingTax(NumberUtil.getNumberStr(bo.getWithholdingTax(), 2));
                vo.setTbmaCode(bo.getTbmaCode());
                vo.setIdentifyId(bo.getIdentifyId());

                BO2VOPaymentMethod(vo.getPaymentMethodVO(), bo.getPaymentMethod());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOProcessSwift(ProcessSwiftVO vo, ProcessSwift bo){
        try{
            if(bo != null && vo != null){
                vo.setSwiftMethod(""+bo.getSwiftMethod());
                vo.setOthMethod(""+bo.getOthMethod());
                vo.setIncludeMt202(""+bo.getIncludeMt202());
                vo.setId(""+bo.getId());
                vo.setCountProcess(""+bo.getCountProcess());
                vo.setConfirmMethodSwift(""+bo.getConfirmMethodSwift());
                vo.setConfirmMethodAnnexII(""+bo.getConfirmMethodAnnexII());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOMarketPrice(MarketPriceVO vo, MarketPrice bo){
        try{
            if(bo != null && vo != null){
                vo.setId(""+bo.getId());
                vo.setSymbol(bo.getSymbol());
                vo.setMaturity(DateUtils.getDateStr(bo.getMaturity(), false));
                vo.setAvgBidding(NumberUtil.getIntFormat(bo.getAvgBidding()));
                vo.setGovtInterpoLatedYield(NumberUtil.getIntFormat(bo.getGovtInterpoLatedYield()));
                vo.setTtm(NumberUtil.getIntFormat(bo.getTtm()));
                vo.setSpreadQuotedDate(DateUtils.getDateStr(bo.getSpreadQuotedDate(), false));
                vo.setSpread(NumberUtil.getIntFormat(bo.getSpread()));
                vo.setReferenceYield(NumberUtil.getIntFormat(bo.getReferenceYield()));
                vo.setSettlementDate(DateUtils.getDateStr(bo.getSettlementDate(), false));
                vo.setAi(NumberUtil.getIntFormat(bo.getAi()));
                vo.setGrossPrice(NumberUtil.getNumberStr(bo.getGrossPrice(), 6));
                vo.setCleanPrice(NumberUtil.getNumberStr(bo.getCleanPrice(), 6));
                vo.setModifiedDuration(NumberUtil.getIntFormat(bo.getModifiedDuration()));
                vo.setConvexity(NumberUtil.getIntFormat(bo.getConvexity()));
                vo.setCreateDate(DateUtils.getDateStr(bo.getCreateDate(), false));
                vo.setCreateBy(bo.getCreateBy());
                vo.setUpdateDate(DateUtils.getDateStr(bo.getUpdateDate(), false));
                vo.setUpdateBy(bo.getUpdateBy());
                vo.setProcessDate(DateUtils.getDateStr(bo.getProcessDate(), false));
                vo.setBondType(bo.getBondType());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void BO2VODealCollateral(DealCollateralVO vo, DealCollateral bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setDirtyPrice(NumberUtil.getNumberStr(bo.getDirtyPrice(), 6));
                vo.setCleanPrice(NumberUtil.getNumberStr(bo.getCleanPrice(), 6));
                vo.setPurchaseUnit(NumberUtil.getNumberStr(bo.getPurchaseUnit(), 2));
                vo.setParValue(NumberUtil.getNumberStr(bo.getParValue(), 2));
                vo.setSecMarketValue(NumberUtil.getNumberStr(bo.getSecMarketValue(), 2));
                vo.setCashAmount(NumberUtil.getNumberStr(bo.getCashAmount(), 2));
                vo.setYtm(NumberUtil.getNumberStr(bo.getYtm(), 2));
                vo.setDirtyPriceAfterHC(NumberUtil.getNumberStr(bo.getDirtyPriceAfterHC(), 2));
                vo.setTerminationValue(NumberUtil.getNumberStr(bo.getTerminationValue() ,2));
                vo.setWithholdingTaxAmt(NumberUtil.getNumberStr(bo.getWithholdingTaxAmt(), 2));
                vo.setRepoIntAmt(NumberUtil.getNumberStr(bo.getRepoIntAmt(), 2));
                vo.setDraft(""+bo.getDraft());
                vo.setHaircut(NumberUtil.getNumberStr(bo.getHaircut(), 6));
                vo.setVariation(NumberUtil.getNumberStr(bo.getVariation(), 6));
                vo.setTrans_no(bo.getTrans_no());

                //object VO
                BO2VOCollateralType(vo.getCollateralTypeVO(), bo.getCollateralType());
                BO2VOPortfolio(vo.getPortfolioVO(), bo.getPortfolio());
                BO2VORepoDeal(vo.getRepoDealVO(), bo.getRepoDeal());
                BO2VOSecurity(vo.getSecurityVO(), bo.getSecurity());
                BO2VOMarginType(vo.getMarginTypeVO(), bo.getMarginType());
                BO2VOMarginIntTerm(vo.getMarginIntTermVO(), bo.getMarginIntTerm());
                BO2VOMarginIntType(vo.getMarginIntTypeVO(), bo.getMarginIntType());
                BO2VOInitialMargin(vo.getInitialMarginVO(), bo.getInitialMargin());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOCollateralType(CollateralTypeVO vo, CollateralType bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOSecurity(SecurityVO vo, Security bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());
                vo.setIsinCode(bo.getIsinCode());
                vo.setIssuerDate(DateUtils.getDateStr(bo.getIssuerDate(), false));
                vo.setMaturityDate(DateUtils.getDateStr(bo.getMaturityDate(), false));
                vo.setPar(NumberUtil.getNumberStr(bo.getPar(), 2));
                vo.setXiPeriod(""+bo.getXiPeriod());
                vo.setXaPeriod(""+bo.getXaPeriod());
                vo.setSpread(NumberUtil.getNumberStr(bo.getSpread(), 2));
                vo.setCouponRate(NumberUtil.getNumberStr(bo.getCouponRate(), 6));
                vo.setCrm(""+bo.getCrm());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOMarginType(MarginTypeVO vo, MarginType bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOMarginIntTerm(MarginIntTermVO vo, MarginIntTerm bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
                vo.setDescription(bo.getDescription());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOMarginIntType(MarginIntTypeVO vo, MarginIntType bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setName(bo.getName());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void BO2VOInitialMargin(InitialMarginVO vo, InitialMargin bo){
        try{
            if(bo != null && vo != null){      
                vo.setId(""+bo.getId());
                vo.setDescription(bo.getDescription());
                vo.setHaircutMargin(NumberUtil.getNumberStr(bo.getHaircutMargin(), 6));
                vo.setVariationMargin(NumberUtil.getNumberStr(bo.getVariationMargin(), 6));
                vo.setApplyFlag(bo.getApplyFlag());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    

    //################################## START ZONE VO2BO ########################################
    
    public static void VO2BORepoDeal(RepoDeal bo, RepoDealVO vo){
        try{
            if(bo != null && vo != null){            
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setDealNo(StringUtils.parseInteger(vo.getDealNo()));
                bo.setTranNo(vo.getTranNo());
                bo.setTradeDate(DateUtils.createDate(vo.getTradeDate(), false));
                bo.setDraft(StringUtils.parseInteger(vo.getDraft()));
                bo.setYearBasis(StringUtils.parseInteger(vo.getYearBasis()));
                bo.setAuthorizedLevel(vo.getAuthorizedLevel()==null?null:vo.getAuthorizedLevel().charAt(0));
                bo.setSettlementDate(DateUtils.createDate(vo.getSettlementDate(), false));
                bo.setPeriod(vo.getPeriod());
                bo.setMaturityDate(DateUtils.createDate(vo.getMaturityDate(), false));
                bo.setPurchasePrice(StringUtils.parseDouble(vo.getPurchasePrice()));
                bo.setRepoIntRate(StringUtils.parseDouble(vo.getRepoIntRate()));
                bo.setInterestAmount(StringUtils.parseDouble(vo.getInterestAmount()));
                bo.setRepurchasePrice(StringUtils.parseDouble(vo.getRepurchasePrice()));
                bo.setCounterPartyLimitFlag(vo.getCounterPartyLimitFlag());
                bo.setReportTime(DateUtils.createDateTime(vo.getReportTime(), false));
                bo.setSystemDate(DateUtils.createDate(vo.getSystemDate(), false));
                bo.setWithHoldingTaxAmt(StringUtils.parseDouble(vo.getWithHoldingTaxAmt()));
                bo.setCommentaries(vo.getCommentaries());
                bo.setBilateralContractNo(vo.getBilateralContractNo());
                bo.setDealStatus(vo.getDealStatus());
                bo.setTerminationValue(StringUtils.parseDouble(vo.getTerminationValue()));
                bo.setTerminateDate(DateUtils.createDate(vo.getTerminationDate(), false));
                bo.setRemarkCancel(vo.getRemarkCancel());
                bo.setCancelStatus(vo.getCancelStatus());
                bo.setCancelDate(DateUtils.createDate(vo.getCancelDate(), false));
                int balanceFlag = vo.getBalanceFlag()==null||"".equals(vo.getBalanceFlag())?0:StringUtils.parseInteger(vo.getBalanceFlag());
                bo.setBalanceFlag(balanceFlag);
                
                bo.setWithHoldingTax(StringUtils.parseDouble(vo.getWithHoldingTax()));

                VO2BODealer(bo.getDealer(), vo.getDealerVO());
                VO2BOUser(bo.getTrader(), vo.getTraderVO());
                VO2BOInstrument(bo.getInstrument(), vo.getInstrumentVO());
                VO2BOInstType(bo.getInstType(), vo.getInstTypeVO());
                VO2BOTransType(bo.getTransType(), vo.getTransTypeVO());
                VO2BOPortfolio(bo.getPortfolio(), vo.getPortfolioVO());
                VO2BOPurpose(bo.getPurpose(), vo.getPurposeVO());
                VO2BOMarginPaymentMethod(bo.getMarginPaymentMethod(), vo.getMarginPaymentMethodVO());
                VO2BORepoIntTerm(bo.getRepoIntTerm(), vo.getRepoIntTermVO());
                VO2BOPaymentMethod(bo.getPaymentMethod(), vo.getPaymentMethodVO());
                VO2BODeskBook(bo.getDeskBook(), vo.getDeskBookVO());
                VO2BOCurrency(bo.getCurrency(), vo.getCurrencyVO());
                VO2BOCounterParty(bo.getCounterParty(), vo.getCounterPartyVO());
                VO2BOProcessSwift(bo.getProcessSwift(), vo.getProcessSwiftVO());           
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void VO2BODealer(Dealer bo, DealerVO vo){
        try{
            if(bo != null && vo != null){            
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setDealerCode(vo.getDealerCode());
                bo.setDealerName(vo.getDealerName());
                bo.setCreateDate(DateUtils.createDate(vo.getCreateDate(), false));
                bo.setCreateBy(vo.getCreateBy());
                bo.setUpdateDate(DateUtils.createDate(vo.getUpdateDate(), false));
                bo.setUpdateBy(vo.getUpdateBy());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void VO2BOUser(User bo, UserVO vo){
        try{
            if(bo != null && vo != null){            
                bo.setUserId(vo.getUserId());
                bo.setPassword(vo.getPassword());
                bo.setStatus(vo.getStatus());
                bo.setName(vo.getName());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void VO2BOInstrument(Instrument bo, InstrumentVO vo){
        try{
            if(bo != null && vo != null){            
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());
                bo.setMonth(StringUtils.parseInteger(bo.getMonth()));
                bo.setIncrementorUnit(StringUtils.parseDouble(bo.getIncrementorUnit()));
                bo.setMinimum(StringUtils.parseDouble(bo.getMinimum()));
                bo.setMaximum(StringUtils.parseDouble(bo.getMaximum()));
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOInstType(InstType bo, InstTypeVO vo){
        try{
            if(bo != null && vo != null){  
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOTransType(TransType bo, TransTypeVO vo){
        try{
            if(bo != null && vo != null){     
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOPortfolio(Portfolio bo, PortfolioVO vo){
        try{
            if(bo != null && vo != null){            
                bo.setId(vo.getId());
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOPurpose(Purpose bo, PurposeVO vo){
        try{
            if(bo != null && vo != null){  
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
                bo.setShort_desc(vo.getShort_desc());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOMarginPaymentMethod(MarginPaymentMethod bo, MarginPaymentMethodVO vo){
        try{
            if(bo != null && vo != null){          
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BORepoIntTerm(RepoIntTerm bo, RepoIntTermVO vo){
        try{
            if(bo != null && vo != null){           
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOPaymentMethod(PaymentMethod bo, PaymentMethodVO vo){
        try{
            if(bo != null && vo != null){   
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BODeskBook(DeskBook bo, DeskBookVO vo){
        try{
            if(bo != null && vo != null){   
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());                
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOCurrency(Currency bo, CurrencyVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setCurrencyCode(vo.getCurrencyCode());
                bo.setDescription(vo.getDescription());     
                bo.setGlCurCode(vo.getGlCurCode());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOCounterParty(CounterParty bo, CounterPartyVO vo){
        try{
            if(bo != null && vo != null){   
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setCustCode(vo.getCustCode());
                bo.setEngName(vo.getEngName());
                bo.setAddress1(vo.getAddress1());
                bo.setThaiName(vo.getThaiName());
                bo.setSwiftCode(vo.getSwiftCode());
                bo.setCaNo(vo.getCaNo());
                bo.setSaNo(vo.getSaNo());
                bo.setContactName(vo.getContactName());
                bo.setTelNo(vo.getTelNo());
                bo.setFaxNo(vo.getFaxNo());
                bo.setSignedISMADate(vo.getSignedISMADate());
                bo.setAccountNo(vo.getAccountNo());
                bo.setThreshold(StringUtils.parseDouble(vo.getThreshold()));
                bo.setWithholdingTax(StringUtils.parseDouble(vo.getWithholdingTax()));
                bo.setTbmaCode(vo.getTbmaCode());
                bo.setIdentifyId(vo.getIdentifyId());

                VO2BOPaymentMethod(bo.getPaymentMethod(), vo.getPaymentMethodVO());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOProcessSwift(ProcessSwift bo, ProcessSwiftVO vo){
        try{
            if(bo != null && vo != null){
                bo.setSwiftMethod(StringUtils.parseInteger(vo.getSwiftMethod()));
                bo.setOthMethod(StringUtils.parseInteger(vo.getOthMethod()));
                bo.setIncludeMt202(StringUtils.parseInteger(vo.getIncludeMt202()));
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setCountProcess(StringUtils.parseInteger(vo.getCountProcess()));
                bo.setConfirmMethodSwift(StringUtils.parseInteger(vo.getConfirmMethodSwift()));
                bo.setConfirmMethodAnnexII(StringUtils.parseInteger(vo.getConfirmMethodAnnexII()));
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    
    public static void VO2BODealCollateral(DealCollateral bo, DealCollateralVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setDirtyPrice(StringUtils.parseDouble(vo.getDirtyPrice()));
                bo.setCleanPrice(StringUtils.parseDouble(vo.getCleanPrice()));
                bo.setPurchaseUnit(StringUtils.parseDouble(vo.getPurchaseUnit()));
                bo.setParValue(StringUtils.parseDouble(vo.getParValue()));
                bo.setSecMarketValue(StringUtils.parseDouble(vo.getSecMarketValue()));
                bo.setCashAmount(StringUtils.parseDouble(vo.getCashAmount()));
                bo.setYtm(StringUtils.parseDouble(vo.getYtm()));
                bo.setDirtyPriceAfterHC(StringUtils.parseDouble(vo.getDirtyPriceAfterHC()));
                bo.setTerminationValue(StringUtils.parseDouble(vo.getTerminationValue()));
                bo.setWithholdingTaxAmt(StringUtils.parseDouble(vo.getWithholdingTaxAmt()));
                bo.setRepoIntAmt(StringUtils.parseDouble(vo.getRepoIntAmt()));
                bo.setDraft(StringUtils.parseInteger(vo.getDraft()));
                bo.setHaircut(StringUtils.parseDouble(vo.getHaircut()));
                bo.setVariation(StringUtils.parseDouble(vo.getVariation()));
                bo.setTrans_no(vo.getTrans_no());

                //object VO
                VO2BOCollateralType(bo.getCollateralType(), vo.getCollateralTypeVO());
                VO2BOPortfolio(bo.getPortfolio(), vo.getPortfolioVO());
                VO2BORepoDeal(bo.getRepoDeal(), vo.getRepoDealVO());
                VO2BOSecurity(bo.getSecurity(), vo.getSecurityVO());
                VO2BOMarginType(bo.getMarginType(), vo.getMarginTypeVO());
                VO2BOMarginIntTerm(bo.getMarginIntTerm(), vo.getMarginIntTermVO());
                VO2BOMarginIntType(bo.getMarginIntType(), vo.getMarginIntTypeVO());
                VO2BOInitialMargin(bo.getInitialMargin(), vo.getInitialMarginVO());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOCollateralType(CollateralType bo, CollateralTypeVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOSecurity(Security bo, SecurityVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());
                bo.setIsinCode(vo.getIsinCode());
                bo.setIssuerDate(DateUtils.createDate(vo.getIssuerDate(), false));
                bo.setMaturityDate(DateUtils.createDate(vo.getMaturityDate(), false));
                bo.setPar(StringUtils.parseDouble(vo.getPar()));
                bo.setXiPeriod(StringUtils.parseInteger(vo.getXiPeriod()));
                bo.setXaPeriod(StringUtils.parseInteger(vo.getXaPeriod()));
                bo.setSpread(StringUtils.parseDouble(vo.getSpread()));
                bo.setCouponRate(StringUtils.parseDouble(vo.getCouponRate()));
                bo.setCrm(vo.getCrm()==null?null:vo.getCrm().charAt(0));
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOMarginType(MarginType bo, MarginTypeVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOMarginIntTerm(MarginIntTerm bo, MarginIntTermVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
                bo.setDescription(vo.getDescription());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOMarginIntType(MarginIntType bo, MarginIntTypeVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setName(vo.getName());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }    
    public static void VO2BOInitialMargin(InitialMargin bo, InitialMarginVO vo){
        try{
            if(bo != null && vo != null){      
                bo.setId(StringUtils.parseInteger(vo.getId()));
                bo.setDescription(vo.getDescription());
                bo.setHaircutMargin(StringUtils.parseDouble(vo.getHaircutMargin()));
                bo.setVariationMargin(StringUtils.parseDouble(vo.getVariationMargin()));
                bo.setApplyFlag(vo.getApplyFlag());
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    */
    
}
